package com.ldn.cron;

import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import com.ldn.basic.utils.DataUtil;

import java.util.*;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author 李大牛家的牛 (scafel@163.com) 
 * @createDate 2024/9/4 - 13:36
 * @description ...
 **/
@Slf4j
@Component
public class DemoCron {

    private final Map<String, String> futures = new ConcurrentHashMap<>();

    @Scheduled(fixedDelay=10*60*1000) // 每隔十分
    @Transactional
    public void checkCouponEnd() {
        if (DataUtil.isDev()){
            log.info("开发环境不执行");
            return;
        }
        // 具体的业务逻辑
    }

}
